package cn.ustb.serviceImpl;

import cn.ustb.dao.ExamArrangeDao;
import cn.ustb.entity.ExamArrange;
import cn.ustb.service.ExamArrangeService;
import cn.ustb.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author yuyan
 */
public class ExamArrangeServiceImpl implements ExamArrangeService {
    @Override
    public List<ExamArrange> getAllWithYearTerm(String studentId, String yearTerm) {
        SqlSession sqlSession=null;
        try{
            sqlSession= MyBatisUtil.getInstance();
            ExamArrangeDao examArrangeDao=sqlSession.getMapper(ExamArrangeDao.class);
            return examArrangeDao.getAllWithYearTerm(studentId, yearTerm);
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if (sqlSession!=null){
                sqlSession.close();
            }
        }
        return null;
    }

    @Override
    public List<ExamArrange> getAllWithStudentId(String studentId) {
        SqlSession sqlSession=null;
        try{
            sqlSession= MyBatisUtil.getInstance();
            ExamArrangeDao examArrangeDao=sqlSession.getMapper(ExamArrangeDao.class);
            return examArrangeDao.getAllWithStudentId(studentId);
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if (sqlSession!=null){
                sqlSession.close();
            }
        }
        return null;
    }
}
